#include "StdAfx.h"
#include "RandomGeneratedStreamInput.h"
#include "SchemaInterpreter.h"
#include "DocumentIdentifierGenerator.h"
#include "TimestampGenerator.h"
 int RandomGeneratedStreamInput::throughout = 0;
RandomGeneratedStreamInput::RandomGeneratedStreamInput(boost::shared_ptr<JsonSchema> schema):IStreamInput(schema)
{
	this->schema = schema;
}


RandomGeneratedStreamInput::~RandomGeneratedStreamInput(void)
{
}
void RandomGeneratedStreamInput::getNextElement(Element& element)
{
	throughout++;
	Document outputDocument;

	SchemaInterpreter::generateRandomDocumentBySchema(this->schema,outputDocument);

	element.document = outputDocument;
	element.id = DocumentIdentifierGenerator::generateNewDocumentIdentifier();
	element.mark = PLUS_MARK;
	element.timestamp = TimestampGenerator::getCurrentTime();
}
bool RandomGeneratedStreamInput::isEmpty()
{
	//wangyan return true;
	return false;
}
void RandomGeneratedStreamInput::initial()
{

}